{extend name="mainadmin@layouts/base" /}
{block name="main" }

<header class="header  b-b clearfix">
    <div class="page-breadcrumbs">
        <ul class="breadcrumb">
            <li>
                <i class="fa fa-ellipsis-v"></i>
                <strong>短信接口</strong>
            </li>
        </ul>
    </div>
</header>
<form class="form-horizontal form-validate form_vbox" method="post" action="{:url('save')}">
    <section class="vbox">
        <section class="scrollable  wrapper w-f">
            <section class="panel panel-default">
                <div class="widget-body">
                    <div class="collapse in">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">上传类型：</label>
                            <div class="col-sm-8 must">
                                <select id="supplier" class="input-min" data-rule-required="true" name="supplier">
                                    <option value="0" >本地存储</option>
                                    {volist name="list" id="val"}
                                    <option value="{$val.id}" {$uploadType == $val.id?'selected=""':''}>{$val.name}</option>
                                    {/volist}
                                </select>
                                <span class="tooltip-darkorange fa fa-question-circle" data-toggle="tooltip" data-placement="right" data-original-title="文件储存配置，注意：一旦配置就不要轻易修改，会导致文件不能使用"></span>
                            </div>
                        </div>
                        <div id="function_val_box">
                            <!-- {volist name="list.function_val" id="val"}
                            <div class="form-group">
                                <label class="control-label">{$function[$row["function"]][val][$key]}：</label>
                                <div class="col-sm-8 ">
                                    <input type="text" name="function_val[{$key}]" class="input-max"
                                           data-rule-required="true" value="{$val}">
                                </div>
                            </div>
                            {/volist} -->
                        </div>                        
                    </div>
            </section>
        </section>
        <footer class="footer bg-white b-t p-t">
            <div class="form-group">
                <div class="col-sm-4 col-sm-offset-1">
                    <button type="submit" class="btn btn-primary js_save_submit" data-loading-text="保存中...">保存</button>
                    <button type="button" class="btn btn-default" data-toggle="back">取消</button>
                </div>
            </div>
        </footer>
    </section>
</form>
{literal}
<script type="text/html" id="text_tpl">
    {{each def_config as item index}}
    <div class="form-group">
        <label class="col-sm-2 control-label">{{item.label}}：</label>
        <div class="col-sm-8 ">
            {{if is_config == 1}}
            <input type="text" name="def_config[{{item.name}}]" class="input-max" data-rule-required="true" placeholder="{{item.tip}}" value="{{config[item.name]}}">
            {{else}}
             <input type="text" name="def_config[{{item.name}}]" class="input-max" data-rule-required="true" placeholder="{{item.tip}}" value="{{}}">
            {{/if}}
        </div>
    </div>
    {{/each}}
</script>
{/literal}
<script type="text/javascript">
    $(function () {
        $("#supplier").change(function () {
            var id = $(this).val();
            setTmp(id);
        })
        setTmp($("#supplier").val());
    })

    function setTmp(id) {
        $("#function_val_box").html('');
        if (id > 0) {
            var list = {$list|json_encode|raw};
            var info = list[id];
           $("#function_val_box").html(template("text_tpl", info)); 
        }
    }
</script>


{/block}

{block name="footer" }
<script type="text/javascript">
    seajs.use(["dist/plupload/init.js"])
</script>
{/block}